package com.guangyunl.d_array;
//二维数组中存储元素
public class Demo02Array {
    public static void main(String[] args) {
        String[][] arr1 = new String[2][2];
        arr1[0][0] = "孙悟空";
        arr1[0][1] = "唐僧";
        arr1[1][0] = "刘备";
        arr1[1][1] = "关羽";

        System.out.println("========================");

        for (int i = 0; i < arr1.length; i++) {
            for (int j = 0; j < arr1[i].length; j++) {
                System.out.print("arr1["+ i +"][" + j + "] = " + arr1[i][j]);
                System.out.print("  ");
            }
            System.out.println();
        }

        System.out.println("========================");

        System.out.println("arr1[0][0] = " + arr1[0][0]);
        System.out.println("arr1[0][1] = " + arr1[0][1]);
        System.out.println("arr1[1][0] = " + arr1[1][0]);
        System.out.println("arr1[1][1] = " + arr1[1][1]);

    }
}

/*
========================
arr1[0][0] = 孙悟空  arr1[0][1] = 唐僧
arr1[1][0] = 刘备  arr1[1][1] = 关羽
========================
arr1[0][0] = 孙悟空
arr1[0][1] = 唐僧
arr1[1][0] = 刘备
arr1[1][1] = 关羽
 */